/**
 * Created by Administrator on 2018/7/24.
 */
$CertusJsonAjax.ajax("queryContractFileTrace",{
    "processInstanceId": $CertusJsonAjax.getProInstanceId(),
    "stepInstanceId": $CertusJsonAjax.getStepInstanceId()
},function(res){
    $$scope.processCCBXTrace = res.data;
})
$CertusJsonAjax.ajax("contractFileBacklog",{
    "processInstanceId": $CertusJsonAjax.getProInstanceId(),
    "stepInstanceId": $CertusJsonAjax.getStepInstanceId()
},function(res){
    $$scope.contractInfo = res.data.contractInfo;
    $$scope.projInfo = res.data.projInfo;
    $$scope.contractFile = res.data.contractFile;
    $$scope.contractFile.stepInstanceId = $CertusJsonAjax.getStepInstanceId();
})

function contractFileDownload(){
    $CertusFormAjax.download("contractFileDownload","projId="+$$scope.projInfo.id+"&uploadFilePath="+$$scope.contractFile.filePathId);
}

$$scope.getState = function (a) {

    if (a == "1") {
        return "运行中"
    } else if (a == "2") {
        return "已关闭"
    } else if (a == "3") {
        return "已完结"
    } else if (a == "4") {
        return "已暂停"
    }
}

$$scope.contractFilePromise = function(){
    $$scope.contractFile.originReason = "promise";
    $CertusJsonAjax.ajax("promiseContractFile",$$scope.contractFile,function(res){
        if(res.data){
            if(res.data == "success"){
                window.history.back()
            }
        }
    })
}

$$scope.contractFileDenied = function(){
    $$scope.contractFile.originReason = "denied"
    $CertusJsonAjax.ajax("unPromiseContractFile",$$scope.contractFile,function(res){
        if(res.data){
            if(res.data == "success"){
                window.history.back()
            }
        }
    })
}

function getState(a){
    if(a == "1"){
        return "运行中"
    }else if(a == "2"){
        return "已关闭"
    }else if(a == "3"){
        return "已完结"
    }else if(a == "4"){
        return "已暂停"
    }
}

$$scope.getProjLv = function (projLv) {
    if (projLv == "1") {
        return "低";
    } else if (projLv == "2") {
        return "中";
    } else if (projLv == "3") {
        return "高"
    }
}